package io.gitee.chearnee.fw.socket.base;

import cn.hutool.extra.spring.SpringUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * @author NN
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class SocketConstant {
  private static  ObjectMapper objectMapper = null;
  private static final Object OBJECT =new Object();

  public static ObjectMapper getObjectMapper() {
    if (objectMapper != null) {
      return objectMapper;
    }
    synchronized (OBJECT) {
      if (objectMapper != null) {
        return objectMapper;
      }
       objectMapper = SpringUtil.getBean(ObjectMapper.class);
      return objectMapper;
    }
  }
}
